package com.mapforge.gui.frames;

import javax.swing.JFrame;

import com.mapforge.gui.frames.map.NewMapDialogProvider;
import com.mapforge.gui.frames.map.ResizeMapDialogProvider;
import com.mapforge.gui.frames.tilelayer.NewTileLayerDialogProvider;
import com.mapforge.gui.frames.tileset.NewTilesetDialogProvider;
import com.mapforge.gui.frames.tileset.TilesetEditorDialogProvider;

/**
 * A wrapper allowing access to dialog classes in the application.
 * 
 * @author Will Morrison
 * 
 */
public class DialogDisplayManager {

	/**
	 * Weakly referenced tileset editor frame provider. Tileset properties can
	 * be edited in the frame provided.
	 */
	private TilesetEditorDialogProvider tilesetEditorDialog;

	/**
	 * 
	 */
	private NewTilesetDialogProvider newTilesetDialog;

	/**
	 * Weakly referenced frame provider. The frame provided here interfaces with
	 * the user and allows the creation of new tile layers.
	 */
	private NewTileLayerDialogProvider newTileLayerDialog;

	/**
	 * Editor where new maps are created
	 */
	private NewMapDialogProvider newMapDialog;

	/**
	 * Weakly referenced dialog allowing maps to be resized.
	 */
	private ResizeMapDialogProvider resizeMapDialog;

	private AboutApplicationDialogProvider aboutApplicationDialog;

	public DialogDisplayManager(JFrame parent) {

		this.newMapDialog = new NewMapDialogProvider(parent);
		this.newTilesetDialog = new NewTilesetDialogProvider(parent);
		this.tilesetEditorDialog = new TilesetEditorDialogProvider(parent);
		this.newTileLayerDialog = new NewTileLayerDialogProvider(parent);
		this.aboutApplicationDialog = new AboutApplicationDialogProvider(parent);
		this.resizeMapDialog = new ResizeMapDialogProvider(parent);

		this.newMapDialog.addMapCreationListener(newTileLayerDialog);
		this.newMapDialog.addMapCreationListener(resizeMapDialog);
	}

	public AboutApplicationDialogProvider getAboutApplicationDialogProvider() {
		return this.aboutApplicationDialog;
	}

	public NewMapDialogProvider getNewMapDialogProvider() {
		return this.newMapDialog;
	}

	public NewTilesetDialogProvider getNewTilesetDialogProvider() {
		return this.newTilesetDialog;
	}

	public TilesetEditorDialogProvider getTilesetEditorDialogProvider() {
		return this.tilesetEditorDialog;
	}

	public NewTileLayerDialogProvider getNewTileLayerDialogProvider() {
		return this.newTileLayerDialog;
	}

	public ResizeMapDialogProvider getResizeMapDialogProvider() {
		return this.resizeMapDialog;
	}
}